package com.sm.honkon.ui.model

import androidx.lifecycle.viewModelScope
import au.com.safie.user.app.util.CacheUtil
import com.sm.honkon.app.App
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

class ResetSettingViewModel : BaseViewModel() {
    val customerDao = App.database.customerDao()
    val handleDao = App.database.handleDao()
    val logcatDao = App.database.logcatDao()

    fun reset(callback: () -> Unit) {
        viewModelScope.launch(Dispatchers.IO) {
            customerDao.deleteAll()
            handleDao.deleteAll()
            logcatDao.deleteAll()
            CacheUtil.clear()
        }
    }
}